<?php

namespace App\Controller\Web;

use App\Base\BaseController4Web;
use App\Model\ArtCategoryModel;
use App\Model\QuestionModel;
use App\Project\ZhengHuaModel;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;

class SideController extends BaseController4Web
{
    /**
     * @route("/ArtListRelate",name="ArtListRelate")
     */
    public function ArtListRelate(Request $request)
    {
        $this->initData();
        if (!$page = $request->query->get("page")) { $page = 0; }
        if (!$limit = $request->query->get("limit")) { $limit = 10; }
        if (!$category = $request->query->get("category")) { $category = 0; }
        if (!$province = $request->query->get("province")) { $province = 0; }
        if (!$tpl = $request->query->get("tpl")) { $tpl = "index" ; }
        $ZhengHuaModel = new ZhengHuaModel($this->getDoctrine());
        $data = $ZhengHuaModel->getIndexData($category,$page,$limit,$province);
        $this->data["list"] = $data;
        return $this->render("Web/List/$tpl.html.twig", $this->data);
    }
    /**
     * 热门优先级1.ishot,2scan,3addtime
     * @route("/ArtListHot",name="ArtListHot")
     */
    public function ArtListHot(Request $request)
    {
        $this->initData();
        if (!$page = $request->query->get("page")) { $page = 0; }
        if (!$limit = $request->query->get("limit")) { $limit = 10; }
        if (!$category = $request->query->get("category")) { $category = 0; }
        if (!$province = $request->query->get("province")) { $province = 0; }
        if (!$tpl = $request->query->get("tpl")) { $tpl = "index" ; }
        $isHot = 1;
        $ZhengHuaModel = new ZhengHuaModel($this->getDoctrine());
        $data = $ZhengHuaModel->getIndexData($category,$page,$limit,$province,$isHot);
        $this->data["list"] = $data;
        return $this->render("Web/List/$tpl.html.twig", $this->data);
    }

    /**
     * @route("/ActivityForm",name="ActivityForm")
     */
    public function ActivityForm(Request  $request)
    {
        $this->initData();
        if (!$tpl = $request->query->get("tpl")) { $tpl = "index" ; }
        return $this->render("Web/List/$tpl.html.twig", $this->data);
    }

    /**
     * @route("/Questions",name="Questions")
     */
    public function Questions(Request  $request)
    {
        $this->initData();
        if (!$tpl = $request->query->get("tpl")) { $tpl = "index" ; }
        if (!$page = $request->query->get("page")) { $page = 0; }
        if (!$limit = $request->query->get("limit")) { $limit = 10; }
        if (!$isTop = $request->query->get("isTop")) { $isTop = 0; }
        $QuestionModel = new QuestionModel($this->getDoctrine());
        $data = $QuestionModel->getList($page,$limit,$isTop);
        $this->data["list"] = $data;
        return $this->render("Web/List/$tpl.html.twig", $this->data);
    }
}
